package com.example.hello.controller;

import com.example.hello.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author sjw
 * @className HomeController
 * @date 2022/5/19 9:27
 * @description: TODO
 */

@RestController
@RequestMapping("/home")
public class HomeController {

    @Autowired
    private HelloService helloService;

    @GetMapping("/hello/{id}")
    public long hello(@PathVariable String id) {
        return helloService.hello(id);
    }


    @PostMapping("/user")
    public String user(@RequestBody UserDto userDto) throws Exception {
        return helloService.user(userDto);
    }

    @PostMapping("/user_notx")
    public String user_noTx(@RequestBody UserDto userDto) throws Exception {
        return helloService.user_noTx(userDto);
    }

}
